import { ref, computed } from 'vue'
import { defineStore } from 'pinia'
import {cartList}  from '@/api/cart.js'
const userCartInfo = defineStore('cartInfo', {
    state: () => {
        return {
           count:0, //购物车有多少种商品
           list:[]
        }
    },
    actions:{
       
        //调用接口获取购物车信息
       async getCartInfo(){
          let data = (await cartList({page:1,limit:100})).data
          this.count=data.count
          this.list=data.list||[]
        }
    }
  })
  
  export default userCartInfo
  